package com.yzyz.service.impl;

import java.util.List;

import com.yzyz.bean.hotel.HotelPictureBean;
import com.yzyz.dao.IHotelPictureDao;
import com.yzyz.service.IHotelPictureService;
import com.yzyz.utils.error.Error;

/**
 * 酒店图片逻辑操作
 * @author david.sun
 * @date 2010-7-11
 */
public class HotelPictureServiceImpl implements IHotelPictureService {

	IHotelPictureDao hotelPictureDao;
	
	@Override
	public List<HotelPictureBean> listAll(int hotelId) {
		
		return this.hotelPictureDao.getAll(hotelId);
	}

	@Override
	public int add(Object object) {
		HotelPictureBean p = (HotelPictureBean)object;
		if(this.hotelPictureDao.getCount(p.getHotelId()) > 10) {
			return Error.PICUTURE_OVER_COUNT;
		}
		return this.hotelPictureDao.save(object);
	}

	@Override
	public int delete(int id) {
		this.hotelPictureDao.delete(id);
		return Error.SUCCESS;
	}

	@Override
	public Object find(int id) {
		
		return this.hotelPictureDao.get(id);
	}

	@Override
	public int update(Object object) {
		
		this.hotelPictureDao.update(object);
		return Error.SUCCESS;
	}

	@Override
	public void setHotelPictureDao(IHotelPictureDao hotelPictureDao) {
		this.hotelPictureDao = hotelPictureDao;
		
	}

	@Override
	public List<?> paginate(int start, int limit) {
		// TODO Auto-generated method stub
		return null;
	}

}
